home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / boot / initrd.img-2.6.28-15-generic / initrd.img-2.6 / scripts / init-top / framebuffer < prev    next >
Encoding:
Text File  |  2009-10-12  |  2.0 KB  |  103 lines

  1. #!/bin/sh
  2.  
  3. PREREQ=""
  4. prereqs()
  5. {
  6.     echo "$PREREQ"
  7. }
  8. case $1 in
  9. # get pre-requisites
  10. prereqs)
  11.     prereqs
  12.     exit 0
  13.     ;;
  14. esac
  15.  
  16.  
  17. # The options part of the kernel "video=" argument (i.e. everyting
  18. # after "video=<fbdriver>:") has very inconsistent rules.
  19. #
  20. # Generally the following applies:
  21. # 1) options are comma-separated
  22. # 2) options can be in either of these three forms:
  23. #    <arg>=<value>, <arg>:<value>, <boolean-arg>.
  24. # 3) the "mode" option has the form <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m]
  25. #    and may or may not start with "mode="
  26. #
  27. # When the options are used with modules, they need to be space-separated
  28. # and the following conversions are needed:
  29. #    <arg>:<value> -> <arg>=<value>
  30. #    <boolean-arg> -> <boolean-arg>=1
  31. #    <modevalue>   -> mode=<modevalue>
  32. parse_video_opts()
  33. {
  34.     local OPTS="$1"
  35.     local IFS=","
  36.  
  37.     # Must be a line like video=<fbdriver>:<opt1>,[opt2]...
  38.     if [ "${OPTS}" = "${OPTS%%:*}" ]; then
  39.         return
  40.     fi
  41.     OPTS="${OPTS#*:}"
  42.     for opt in ${OPTS}; do
  43.         # Already in the "<arg>=<value>" form
  44.         if [ "${opt}" != "${opt#*=}" ]; then
  45.             echo -n "$opt "
  46.         # In the "<arg>:<value>" form
  47.         elif [ "${opt}" != "${opt#*:}" ]; then
  48.             echo -n "${opt%:*}=${opt#*:} "
  49.         # Presumably a modevalue without the "mode=" prefix
  50.         elif [ "${opt}" != "${opt#[0-9]*x[0-9]}" ]; then
  51.             echo -n "mode=$opt "
  52.         # Presumably a boolean
  53.         else
  54.             echo -n "${opt}=1 "
  55.         fi
  56.     done
  57. }
  58.  
  59. FB=""
  60. OPTS=""
  61.  
  62. for x in $(cat /proc/cmdline); do
  63.     case ${x} in
  64.     vga=*)
  65.         FB="vesafb";
  66.         OPTS="";
  67.         ;;
  68.     video=*)
  69.         FB=${x#*=}
  70.         FB="${FB%%:*}"
  71.         OPTS="$(parse_video_opts "${x}")"
  72.     esac
  73. done
  74.  
  75. # Map command line name to module name
  76. case ${FB} in
  77. matroxfb)
  78.     FB=matroxfb_base
  79.     ;;
  80. uvesafb)
  81.     mknod -m 640 /dev/mem c 1 1
  82.     mknod -m 666 /dev/zero c 1 5
  83.     ;;
  84. *)
  85.     ;;
  86. esac
  87.  
  88. if [ -n "${FB}" ]; then
  89.     unset MODPROBE_OPTIONS
  90.     modprobe -q fbcon
  91.     modprobe -q ${FB} ${OPTS}
  92. fi
  93.  
  94. if [ -e /proc/fb ]; then
  95.     while read fbno desc; do
  96.         if [ $(($fbno < 32)) ]; then
  97.             mknod /dev/fb${fbno} c 29 ${fbno}
  98.         fi
  99.     done < /proc/fb
  100. else
  101.     mknod /dev/fb0 c 29 0
  102. fi
  103.